<template>
  <div>
    <el-row>
      <el-col :span="12">
        <div id="main" style="width: 500px;height: 400px;margin-top: 45px;margin-left: 100px"></div>
      </el-col>

      <el-col :span="12">
        <div id="pie" style="width: 500px;height: 400px;margin-top: 50px"></div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import * as echarts from 'echarts';


export default {
  name: "OperatingState",
  data(){
    return{

    }
  },
  mounted() {
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;

    option = {
      title: {
        text: '库存数据分析',
        left: 'center'
      },
      xAxis: {
        type: 'category',
        data: ['茅台酒', '百事可乐', '雪碧', '青岛啤酒']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: [600, 550, 500, 700],
          type: 'line'
        },
        {
          data: [600, 550, 500, 700],
          type: 'bar'
        }
      ]
    };
    myChart.setOption(option);

    //饼图
    var pieOption = {
      title: {
        text: '供应商',
        subtext: 'Fake Data',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: '50%',
          data: [
            { value: 600, name: '阿里巴巴网络技术有限公司' },
            { value: 550, name: '深圳市腾讯计算机系统有限公司' },
            { value: 500, name: '华为技术有限公司' },
            { value: 700, name: '小米科技有限公司' }
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    };
    var pieDom = document.getElementById('pie');
    var pieChart = echarts.init(pieDom);
    pieChart.setOption(pieOption);
  }
};

</script>

<style scoped>

</style>